import com.example.myproject.Application;
import com.mq.rabbitmq.point.Send;
import com.mq.rabbitmq.point.consumewait.MultiData;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;

/**
 * Created by xi on 2017/8/17.
 */
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(Application.class)
@WebAppConfiguration
public class RabbitMqTestMulitConsume {
    @Autowired
    private Send send;

    /**
     * 测试一个消费者异常
     */
    @Test
    public void testSendWhenOneConsuemException(){
        MultiData data ;
        for(int i =1;i<=1;i++){
            data = new MultiData();
            data.setCount(i);
            data.setStr("我是第"+i+"条消息");
            send.sendMsgForTestOneConsumeExceptionOfMultiConsume(data);
        }
        while(true){}
    }


    /**
     * 测试一个消费者异常
     */
    @Test
    public void testConsumedWhenOneConsuemException(){
        while(true){}
    }
}
